<script type="text/javascript">
var tms = [];
 var day = [];
 var hour = [];
 var minute = [];
 var second = [];
function takeCount() {
    setTimeout("takeCount()", 1000);
    for (var i = 0, j = tms.length; i < j; i++) {
        tms[i] -= 1;
        //计算天、时、分、秒、
        var days = Math.floor(tms[i] / (1 * 60 * 60 * 24));
        var hours = Math.floor(tms[i] / (1 * 60 * 60)) % 24;
        var minutes = Math.floor(tms[i] / (1 * 60)) % 60;
        var seconds = Math.floor(tms[i] / 1) % 60;
        if (days < 0)
            days = 0;
        if (hours < 0)
            hours = 0;
        if (minutes < 0)
            minutes = 0;
        if (seconds < 0)
            seconds = 0;
        //将天、时、分、秒插入到html中
        document.getElementById(day[i]).innerHTML = days;
        document.getElementById(hour[i]).innerHTML = hours;
        document.getElementById(minute[i]).innerHTML = minutes;
        document.getElementById(second[i]).innerHTML = seconds;
    }
}
setTimeout("takeCount()", 1000);
</script>
<header class="layout head padding-small">
    <a href="javascript:back(true);" class="hBack float-left"></a>
    <h4 class="hTxt float-left text-center text-white">限时折扣专区</h4>
    <a href="javascript:;" id="btnJdkey" class="hHlep float-right"></a>
</header>
<div class="layout">
    <div class="container large-con">
        <?php if(!empty($output['list']) && is_array($output['list'])){?>
        <div class="line">
            <?php foreach($output['list'] as $k=>$item){ ?>
            <a url="<?php if(!isset($_SESSION['is_login'])){echo "index.php?act=login";}else{echo "index.php?act=goods&goods_id= {$item['goods_id']}";}?>" class="x12 radius-big bg-white margin-top radius-big text-center app_onclick">
                <img src="<?php echo SiteUrl.DS.ATTACH_GOODS.DS.$item['store_id'].DS.$item['goods_image']?>" onerror="this.src='<?php echo TEMPLATES_PATH.DS.'images/touch2013/no_300_300.jpg'?>'" onload="imgheqw(this)">
                <ul class="list-unstyle location padding-small">
                    <li class="height-small width"><i class="icon-clock"></i>
                        <span id="d<?php echo $k?>">0</span><strong> 天</strong>
                <span id="h<?php echo $k?>">0</span><strong> 时</strong>
                <span id="m<?php echo $k?>">0</span><strong> 分</strong>
                <span id="s<?php echo $k?>">0</span><strong> 秒</strong></li>
                    <li class="height-small width"><?php echo str_cut($item['goods_name'],76)?></li>
                    <li class="height-small width"><?php if($_SESSION['is_login'] != 1){?>
                        &yen; 登录后显示</li>
                        <?php }else{?>
                        <strong class="zt-red text-big">&yen;<?php echo ncPriceFormat($item['goods_store_price']*$item['discount']/10)?></strong><span class="xhx float-right">&yen;<?php echo $item['goods_store_price']?></span></li> <?php }?>


                </ul>
                <div class="label"><span class="text-white  "><?php echo $item['discount']?></span></div>
            </a>
            <?php }?>
        </div><!--//line-->
            <?php include 'page.php';?>
        <?php }else{?>
            <!--无内容S-->
            <ul> <li class="noTxt">
                    <div class="text-center text-gray padding-large">
                        <i class="icon-meh-o"></i>
                        <p>暂无相关的数据记录。</p>
                    </div>
                </li></ul>
            <!--无内容E-->
        <?php }?>
    </div><!--container-->

</div>

<script type="text/javascript">
<?php if(!empty($output['list']) && is_array($output['list'])){?>
<?php foreach($output['list'] as $k=>$item){ ?>
tms[tms.length] = "<?php echo $item['end_time']-time();?>";
day[day.length] = "d<?php echo $k?>";
hour[hour.length] = "h<?php echo $k?>";
minute[minute.length] = "m<?php echo $k?>";
second[second.length] = "s<?php echo $k?>";
<?php }?>
<?php }?>
</script>